package com.icinfo.cloud.provider.punish.app.service;


import com.icinfo.cloud.provider.punish.app.enums.AppCaseConvertTemporaryEnum;
import com.icinfo.cloud.provider.punish.app.mapper.AppCaseConvertTemporaryRecordMapper;
import com.icinfo.cloud.provider.punish.app.model.AppCaseConvertTemporaryRecord;
import com.icinfo.cloud.xzcf.provider.member.userinfo.dto.UserDTO;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * @author HKxxx
 * description 针对表【app_case_convert_temporary_record(普通案件与简单案件转换临时数据表)】的数据库操作Service实现
 * createDate 2024-03-15 16:09:19
 */
@Slf4j
@Service
public class AppCaseConvertTemporaryRecordServiceImpl extends MyBatisServiceSupport implements IAppCaseConvertTemporaryRecordService {

    @Resource
    private AppCaseConvertTemporaryRecordMapper appCaseConvertTemporaryMapper;


    /**
     * 移除当前用户的临时数据
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void removeCurrentUserConvertTemporaryRecord(AppCaseConvertTemporaryEnum currentUserConvertTemporary) {
        UserDTO user = getUser();
        AppCaseConvertTemporaryRecord convertTemporary = new AppCaseConvertTemporaryRecord();
        convertTemporary.setAddUser(String.valueOf(user.getUserId()));
        convertTemporary.setOrgCode(user.getOrgCode());
        convertTemporary.setAreaCode(user.getAreaCode());
        // 删除 简易案件数据转普通案件数据
        convertTemporary.setConvertType(currentUserConvertTemporary.getCode());
        appCaseConvertTemporaryMapper.delete(convertTemporary);
    }


}




